package com.wsjzzcbq.controller;

import com.wsjzzcbq.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * AccountController
 *
 * @author wsjz
 * @date 2023/10/23
 */
@RequestMapping("/account")
@RestController
public class AccountController {

    @Autowired
    private AccountService accountService;

    @GetMapping("/deduct")
    public boolean deductAccount(String userId, int money, boolean rollback) {
        return accountService.deductAccount(userId, money, rollback);
    }

    @GetMapping("/compensate/deduct")
    public boolean compensateDeductAccount(String userId, int money) {
        return accountService.compensateDeductAccount(userId, money);
    }
}
